{
 "cells": [
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "1、练习groupby",
   "id": "18c02a055ebcba87"
  },
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-01-08T08:46:58.574699Z",
     "start_time": "2025-01-08T08:46:57.061225Z"
    }
   },
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "from matplotlib import pyplot as plt"
   ],
   "outputs": [],
   "execution_count": 1
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:50:16.094076Z",
     "start_time": "2025-01-08T08:50:15.330441Z"
    }
   },
   "cell_type": "code",
   "source": [
    "df = pd.read_csv(\"./911.csv\")\n",
    "df.head()"
   ],
   "id": "38978c8dae480b50",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "         lat        lng                                               desc  \\\n",
       "0  40.297876 -75.581294  REINDEER CT & DEAD END;  NEW HANOVER; Station ...   \n",
       "1  40.258061 -75.264680  BRIAR PATH & WHITEMARSH LN;  HATFIELD TOWNSHIP...   \n",
       "2  40.121182 -75.351975  HAWS AVE; NORRISTOWN; 2015-12-10 @ 14:39:21-St...   \n",
       "3  40.116153 -75.343513  AIRY ST & SWEDE ST;  NORRISTOWN; Station 308A;...   \n",
       "4  40.251492 -75.603350  CHERRYWOOD CT & DEAD END;  LOWER POTTSGROVE; S...   \n",
       "\n",
       "       zip                    title            timeStamp                twp  \\\n",
       "0  19525.0   EMS: BACK PAINS/INJURY  2015-12-10 17:10:52        NEW HANOVER   \n",
       "1  19446.0  EMS: DIABETIC EMERGENCY  2015-12-10 17:29:21  HATFIELD TOWNSHIP   \n",
       "2  19401.0      Fire: GAS-ODOR/LEAK  2015-12-10 14:39:21         NORRISTOWN   \n",
       "3  19401.0   EMS: CARDIAC EMERGENCY  2015-12-10 16:47:36         NORRISTOWN   \n",
       "4      NaN           EMS: DIZZINESS  2015-12-10 16:56:52   LOWER POTTSGROVE   \n",
       "\n",
       "                         addr  e  \n",
       "0      REINDEER CT & DEAD END  1  \n",
       "1  BRIAR PATH & WHITEMARSH LN  1  \n",
       "2                    HAWS AVE  1  \n",
       "3          AIRY ST & SWEDE ST  1  \n",
       "4    CHERRYWOOD CT & DEAD END  1  "
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>lat</th>\n",
       "      <th>lng</th>\n",
       "      <th>desc</th>\n",
       "      <th>zip</th>\n",
       "      <th>title</th>\n",
       "      <th>timeStamp</th>\n",
       "      <th>twp</th>\n",
       "      <th>addr</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>40.297876</td>\n",
       "      <td>-75.581294</td>\n",
       "      <td>REINDEER CT &amp; DEAD END;  NEW HANOVER; Station ...</td>\n",
       "      <td>19525.0</td>\n",
       "      <td>EMS: BACK PAINS/INJURY</td>\n",
       "      <td>2015-12-10 17:10:52</td>\n",
       "      <td>NEW HANOVER</td>\n",
       "      <td>REINDEER CT &amp; DEAD END</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>40.258061</td>\n",
       "      <td>-75.264680</td>\n",
       "      <td>BRIAR PATH &amp; WHITEMARSH LN;  HATFIELD TOWNSHIP...</td>\n",
       "      <td>19446.0</td>\n",
       "      <td>EMS: DIABETIC EMERGENCY</td>\n",
       "      <td>2015-12-10 17:29:21</td>\n",
       "      <td>HATFIELD TOWNSHIP</td>\n",
       "      <td>BRIAR PATH &amp; WHITEMARSH LN</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>40.121182</td>\n",
       "      <td>-75.351975</td>\n",
       "      <td>HAWS AVE; NORRISTOWN; 2015-12-10 @ 14:39:21-St...</td>\n",
       "      <td>19401.0</td>\n",
       "      <td>Fire: GAS-ODOR/LEAK</td>\n",
       "      <td>2015-12-10 14:39:21</td>\n",
       "      <td>NORRISTOWN</td>\n",
       "      <td>HAWS AVE</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>40.116153</td>\n",
       "      <td>-75.343513</td>\n",
       "      <td>AIRY ST &amp; SWEDE ST;  NORRISTOWN; Station 308A;...</td>\n",
       "      <td>19401.0</td>\n",
       "      <td>EMS: CARDIAC EMERGENCY</td>\n",
       "      <td>2015-12-10 16:47:36</td>\n",
       "      <td>NORRISTOWN</td>\n",
       "      <td>AIRY ST &amp; SWEDE ST</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>40.251492</td>\n",
       "      <td>-75.603350</td>\n",
       "      <td>CHERRYWOOD CT &amp; DEAD END;  LOWER POTTSGROVE; S...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>EMS: DIZZINESS</td>\n",
       "      <td>2015-12-10 16:56:52</td>\n",
       "      <td>LOWER POTTSGROVE</td>\n",
       "      <td>CHERRYWOOD CT &amp; DEAD END</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 4
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:50:42.655202Z",
     "start_time": "2025-01-08T08:50:42.382521Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 获取分类\n",
    "temp_list = df[\"title\"].str.split(\": \").tolist()\n",
    "temp_list"
   ],
   "id": "7a4c4ba8f2921785",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['EMS', 'BACK PAINS/INJURY'],\n",
       " ['EMS', 'DIABETIC EMERGENCY'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'DIZZINESS'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'NAUSEA/VOMITING'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'DIZZINESS'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Fire', 'APPLIANCE FIRE'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Fire', 'CARBON MONOXIDE DETECTOR'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'ALTERED MENTAL STATUS'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'ASSAULT VICTIM'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'SEIZURES'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'DIABETIC EMERGENCY'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['Fire', 'CARBON MONOXIDE DETECTOR'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['Fire', 'PUMP DETAIL'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'FIRE INVESTIGATION'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'SEIZURES'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'OVERDOSE'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'NAUSEA/VOMITING'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'MATERNITY'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'NAUSEA/VOMITING'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['EMS', 'DIZZINESS'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'CHOKING'],\n",
       " ['EMS', 'LACERATIONS'],\n",
       " ['EMS', 'LACERATIONS'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'CARBON MONOXIDE DETECTOR'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'TRASH/DUMPSTER FIRE'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'DIZZINESS'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['Fire', 'UNKNOWN TYPE FIRE'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'BUILDING FIRE'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['Fire', 'ELECTRICAL FIRE OUTSIDE'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'DEBRIS/FLUIDS ON HIGHWAY'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DEBRIS/FLUIDS ON HIGHWAY -'],\n",
       " ['Fire', 'DEBRIS/FLUIDS ON HIGHWAY'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SEIZURES'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['Fire', 'FIRE INVESTIGATION'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'FEVER'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['EMS', 'SEIZURES'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'ELECTRICAL FIRE OUTSIDE'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['EMS', 'BACK PAINS/INJURY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Fire', 'ELECTRICAL FIRE OUTSIDE'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'ALLERGIC REACTION'],\n",
       " ['EMS', 'DIZZINESS'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'LACERATIONS'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['Traffic', 'VEHICLE LEAKING FUEL -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Fire', 'BUILDING FIRE'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['EMS', 'NAUSEA/VOMITING'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'NAUSEA/VOMITING'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'DIZZINESS'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FRACTURE'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'BURN VICTIM'],\n",
       " ['EMS', 'BURN VICTIM'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'FIRE INVESTIGATION'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['Fire', 'RESCUE - GENERAL'],\n",
       " ['Fire', 'WOODS/FIELD FIRE'],\n",
       " ['EMS', 'RESCUE - GENERAL'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['EMS', 'ALTERED MENTAL STATUS'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'WOODS/FIELD FIRE'],\n",
       " ['EMS', 'BACK PAINS/INJURY'],\n",
       " ['EMS', 'DIABETIC EMERGENCY'],\n",
       " ['EMS', 'DIABETIC EMERGENCY'],\n",
       " ['EMS', 'OVERDOSE'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'FEVER'],\n",
       " ['Fire', 'FIRE SPECIAL SERVICE'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'SEIZURES'],\n",
       " ['EMS', 'ASSAULT VICTIM'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['Fire', 'BUILDING FIRE'],\n",
       " ['Fire', 'VEHICLE FIRE'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE FIRE -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'WARRANT SERVICE'],\n",
       " ['EMS', 'CHOKING'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'UNKNOWN TYPE FIRE'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['EMS', 'BACK PAINS/INJURY'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'ALTERED MENTAL STATUS'],\n",
       " ['EMS', 'ASSAULT VICTIM'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Fire', 'FIRE INVESTIGATION'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'ALLERGIC REACTION'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'SEIZURES'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'SEIZURES'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'FRACTURE'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'FEVER'],\n",
       " ['EMS', 'SEIZURES'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'CARBON MONOXIDE DETECTOR'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'S/B AT HELICOPTER LANDING'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'UNKNOWN TYPE FIRE'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'EMS SPECIAL SERVICE'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['Traffic', 'HAZARDOUS ROAD CONDITIONS -'],\n",
       " ['EMS', 'MATERNITY'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'DIABETIC EMERGENCY'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['EMS', 'ALTERED MENTAL STATUS'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'RESCUE - GENERAL'],\n",
       " ['Fire', 'RESCUE - GENERAL'],\n",
       " ['Traffic', 'VEHICLE FIRE -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Fire', 'VEHICLE FIRE'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'NAUSEA/VOMITING'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'HAZARDOUS ROAD CONDITIONS -'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'CARBON MONOXIDE DETECTOR'],\n",
       " ['EMS', 'SEIZURES'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'ASSAULT VICTIM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'ALTERED MENTAL STATUS'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'RESCUE - ELEVATOR'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'EMS SPECIAL SERVICE'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'ALTERED MENTAL STATUS'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'ALTERED MENTAL STATUS'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FIRE SPECIAL SERVICE'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['Fire', 'FIRE SPECIAL SERVICE'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'FIRE INVESTIGATION'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['EMS', 'DIZZINESS'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'S/B AT HELICOPTER LANDING'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'NAUSEA/VOMITING'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['Fire', 'FIRE SPECIAL SERVICE'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'ALLERGIC REACTION'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['EMS', 'ASSAULT VICTIM'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'NAUSEA/VOMITING'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['Fire', 'S/B AT HELICOPTER LANDING'],\n",
       " ['Fire', 'APPLIANCE FIRE'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'SEIZURES'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CHOKING'],\n",
       " ['Fire', 'CARBON MONOXIDE DETECTOR'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['Fire', 'VEHICLE FIRE'],\n",
       " ['Traffic', 'VEHICLE FIRE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'FRACTURE'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'UNKNOWN TYPE FIRE'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'OVERDOSE'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'ALTERED MENTAL STATUS'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['Fire', 'CARBON MONOXIDE DETECTOR'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'VEHICLE FIRE'],\n",
       " ['Traffic', 'VEHICLE FIRE -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'ASSAULT VICTIM'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'ASSAULT VICTIM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'ASSAULT VICTIM'],\n",
       " ['EMS', 'OVERDOSE'],\n",
       " ['EMS', 'DIZZINESS'],\n",
       " ['EMS', 'LACERATIONS'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'UNKNOWN TYPE FIRE'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'VEHICLE FIRE'],\n",
       " ['Traffic', 'VEHICLE FIRE -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'DEHYDRATION'],\n",
       " ['Fire', 'VEHICLE FIRE'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'VEHICLE FIRE -'],\n",
       " ['EMS', 'ALTERED MENTAL STATUS'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'ALTERED MENTAL STATUS'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'OVERDOSE'],\n",
       " ['Fire', 'TRASH/DUMPSTER FIRE'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'TRASH/DUMPSTER FIRE'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'DIABETIC EMERGENCY'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE FIRE -'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'UNKNOWN TYPE FIRE'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'DIZZINESS'],\n",
       " ['Fire', 'CARBON MONOXIDE DETECTOR'],\n",
       " ['Fire', 'UNKNOWN TYPE FIRE'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Fire', 'UNKNOWN TYPE FIRE'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['Traffic', 'ROAD OBSTRUCTION -'],\n",
       " ['Fire', 'S/B AT HELICOPTER LANDING'],\n",
       " ['EMS', 'DIZZINESS'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'NAUSEA/VOMITING'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['EMS', 'ALTERED MENTAL STATUS'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'DIZZINESS'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'VEHICLE ACCIDENT'],\n",
       " ['EMS', 'FEVER'],\n",
       " ['Fire', 'VEHICLE ACCIDENT'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SEIZURES'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['EMS', 'OVERDOSE'],\n",
       " ['EMS', 'OVERDOSE'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['EMS', 'HEMORRHAGING'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['EMS', 'BACK PAINS/INJURY'],\n",
       " ['EMS', 'FEVER'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'LACERATIONS'],\n",
       " ['EMS', 'OVERDOSE'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'NAUSEA/VOMITING'],\n",
       " ['EMS', 'ASSAULT VICTIM'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['Fire', 'BUILDING FIRE'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'BUILDING FIRE'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'UNRESPONSIVE SUBJECT'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Traffic', 'DISABLED VEHICLE -'],\n",
       " ['Fire', 'ELECTRICAL FIRE OUTSIDE'],\n",
       " ['EMS', 'CVA/STROKE'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['EMS', 'UNKNOWN MEDICAL EMERGENCY'],\n",
       " ['EMS', 'HEAD INJURY'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'ALTERED MENTAL STATUS'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'FRACTURE'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'SYNCOPAL EPISODE'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'NAUSEA/VOMITING'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['EMS', 'NAUSEA/VOMITING'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'CARDIAC EMERGENCY'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['Traffic', 'HAZARDOUS ROAD CONDITIONS -'],\n",
       " ['Fire', 'GAS-ODOR/LEAK'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['EMS', 'ABDOMINAL PAINS'],\n",
       " ['EMS', 'FEVER'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'SUBJECT IN PAIN'],\n",
       " ['EMS', 'UNCONSCIOUS SUBJECT'],\n",
       " ['Fire', 'FIRE ALARM'],\n",
       " ['EMS', 'FALL VICTIM'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['Traffic', 'VEHICLE ACCIDENT -'],\n",
       " ['EMS', 'MEDICAL ALERT ALARM'],\n",
       " ['EMS', 'RESPIRATORY EMERGENCY'],\n",
       " ['EMS', 'GENERAL WEAKNESS'],\n",
       " ...]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 5
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:50:59.783332Z",
     "start_time": "2025-01-08T08:50:59.750888Z"
    }
   },
   "cell_type": "code",
   "source": [
    "cate_list = [i[0] for i in temp_list]\n",
    "cate_list"
   ],
   "id": "1cf936b8cd45db13",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'Fire',\n",
       " 'Traffic',\n",
       " 'Traffic',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Fire',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'Traffic',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " 'EMS',\n",
       " ...]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 6
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:52:12.729029Z",
     "start_time": "2025-01-08T08:52:12.639551Z"
    }
   },
   "cell_type": "code",
   "source": [
    "df[\"cate\"] = pd.DataFrame(np.array(cate_list).reshape((df.shape[0], 1)))\n",
    "df.head()"
   ],
   "id": "5e7517afbfcf5812",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "         lat        lng                                               desc  \\\n",
       "0  40.297876 -75.581294  REINDEER CT & DEAD END;  NEW HANOVER; Station ...   \n",
       "1  40.258061 -75.264680  BRIAR PATH & WHITEMARSH LN;  HATFIELD TOWNSHIP...   \n",
       "2  40.121182 -75.351975  HAWS AVE; NORRISTOWN; 2015-12-10 @ 14:39:21-St...   \n",
       "3  40.116153 -75.343513  AIRY ST & SWEDE ST;  NORRISTOWN; Station 308A;...   \n",
       "4  40.251492 -75.603350  CHERRYWOOD CT & DEAD END;  LOWER POTTSGROVE; S...   \n",
       "\n",
       "       zip                    title            timeStamp                twp  \\\n",
       "0  19525.0   EMS: BACK PAINS/INJURY  2015-12-10 17:10:52        NEW HANOVER   \n",
       "1  19446.0  EMS: DIABETIC EMERGENCY  2015-12-10 17:29:21  HATFIELD TOWNSHIP   \n",
       "2  19401.0      Fire: GAS-ODOR/LEAK  2015-12-10 14:39:21         NORRISTOWN   \n",
       "3  19401.0   EMS: CARDIAC EMERGENCY  2015-12-10 16:47:36         NORRISTOWN   \n",
       "4      NaN           EMS: DIZZINESS  2015-12-10 16:56:52   LOWER POTTSGROVE   \n",
       "\n",
       "                         addr  e  cate  \n",
       "0      REINDEER CT & DEAD END  1   EMS  \n",
       "1  BRIAR PATH & WHITEMARSH LN  1   EMS  \n",
       "2                    HAWS AVE  1  Fire  \n",
       "3          AIRY ST & SWEDE ST  1   EMS  \n",
       "4    CHERRYWOOD CT & DEAD END  1   EMS  "
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>lat</th>\n",
       "      <th>lng</th>\n",
       "      <th>desc</th>\n",
       "      <th>zip</th>\n",
       "      <th>title</th>\n",
       "      <th>timeStamp</th>\n",
       "      <th>twp</th>\n",
       "      <th>addr</th>\n",
       "      <th>e</th>\n",
       "      <th>cate</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>40.297876</td>\n",
       "      <td>-75.581294</td>\n",
       "      <td>REINDEER CT &amp; DEAD END;  NEW HANOVER; Station ...</td>\n",
       "      <td>19525.0</td>\n",
       "      <td>EMS: BACK PAINS/INJURY</td>\n",
       "      <td>2015-12-10 17:10:52</td>\n",
       "      <td>NEW HANOVER</td>\n",
       "      <td>REINDEER CT &amp; DEAD END</td>\n",
       "      <td>1</td>\n",
       "      <td>EMS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>40.258061</td>\n",
       "      <td>-75.264680</td>\n",
       "      <td>BRIAR PATH &amp; WHITEMARSH LN;  HATFIELD TOWNSHIP...</td>\n",
       "      <td>19446.0</td>\n",
       "      <td>EMS: DIABETIC EMERGENCY</td>\n",
       "      <td>2015-12-10 17:29:21</td>\n",
       "      <td>HATFIELD TOWNSHIP</td>\n",
       "      <td>BRIAR PATH &amp; WHITEMARSH LN</td>\n",
       "      <td>1</td>\n",
       "      <td>EMS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>40.121182</td>\n",
       "      <td>-75.351975</td>\n",
       "      <td>HAWS AVE; NORRISTOWN; 2015-12-10 @ 14:39:21-St...</td>\n",
       "      <td>19401.0</td>\n",
       "      <td>Fire: GAS-ODOR/LEAK</td>\n",
       "      <td>2015-12-10 14:39:21</td>\n",
       "      <td>NORRISTOWN</td>\n",
       "      <td>HAWS AVE</td>\n",
       "      <td>1</td>\n",
       "      <td>Fire</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>40.116153</td>\n",
       "      <td>-75.343513</td>\n",
       "      <td>AIRY ST &amp; SWEDE ST;  NORRISTOWN; Station 308A;...</td>\n",
       "      <td>19401.0</td>\n",
       "      <td>EMS: CARDIAC EMERGENCY</td>\n",
       "      <td>2015-12-10 16:47:36</td>\n",
       "      <td>NORRISTOWN</td>\n",
       "      <td>AIRY ST &amp; SWEDE ST</td>\n",
       "      <td>1</td>\n",
       "      <td>EMS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>40.251492</td>\n",
       "      <td>-75.603350</td>\n",
       "      <td>CHERRYWOOD CT &amp; DEAD END;  LOWER POTTSGROVE; S...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>EMS: DIZZINESS</td>\n",
       "      <td>2015-12-10 16:56:52</td>\n",
       "      <td>LOWER POTTSGROVE</td>\n",
       "      <td>CHERRYWOOD CT &amp; DEAD END</td>\n",
       "      <td>1</td>\n",
       "      <td>EMS</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 8
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:55:33.772206Z",
     "start_time": "2025-01-08T08:55:33.693852Z"
    }
   },
   "cell_type": "code",
   "source": "print(df.groupby(by=\"cate\").count())",
   "id": "723d77af7d76d327",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "            lat     lng    desc     zip   title  timeStamp     twp    addr  \\\n",
      "cate                                                                         \n",
      "EMS      124840  124840  124840  113676  124840     124840  124771  124840   \n",
      "Fire      37432   37432   37432   32817   37432      37432   37410   37432   \n",
      "Traffic   87465   87465   87465   72898   87465      87465   87463   87465   \n",
      "\n",
      "              e  \n",
      "cate             \n",
      "EMS      124840  \n",
      "Fire      37432  \n",
      "Traffic   87465  \n"
     ]
    }
   ],
   "execution_count": 15
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:56:58.682661Z",
     "start_time": "2025-01-08T08:56:58.600381Z"
    }
   },
   "cell_type": "code",
   "source": "print(df.groupby(by=\"cate\").count()[\"title\"])",
   "id": "e7e3155080b9e710",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cate\n",
      "EMS        124840\n",
      "Fire        37432\n",
      "Traffic     87465\n",
      "Name: title, dtype: int64\n"
     ]
    }
   ],
   "execution_count": 18
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "2、练习merge",
   "id": "6de233406b42fc48"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:57:25.656179Z",
     "start_time": "2025-01-08T08:57:25.634053Z"
    }
   },
   "cell_type": "code",
   "source": [
    "df_obj1 = pd.DataFrame({'key': ['b', 'b', 'a', 'c', 'a', 'a', 'b'],'data1' : np.random.randint(0,10,7)})\n",
    "df_obj2 = pd.DataFrame({'key': ['a', 'b', 'd'],'data2' : np.random.randint(0,10,3)})\n",
    "print(df_obj1)\n",
    "print(df_obj2)"
   ],
   "id": "2106c15d799b516d",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  key  data1\n",
      "0   b      5\n",
      "1   b      5\n",
      "2   a      4\n",
      "3   c      6\n",
      "4   a      9\n",
      "5   a      7\n",
      "6   b      0\n",
      "  key  data2\n",
      "0   a      9\n",
      "1   b      2\n",
      "2   d      3\n"
     ]
    }
   ],
   "execution_count": 19
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:57:39.350378Z",
     "start_time": "2025-01-08T08:57:39.340344Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 默认将重叠列的列名作为“外键”进行连接\n",
    "print(pd.merge(df_obj1, df_obj2))"
   ],
   "id": "d25d4730b86d8608",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  key  data1  data2\n",
      "0   b      5      2\n",
      "1   b      5      2\n",
      "2   a      4      9\n",
      "3   a      9      9\n",
      "4   a      7      9\n",
      "5   b      0      2\n"
     ]
    }
   ],
   "execution_count": 20
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:57:49.643326Z",
     "start_time": "2025-01-08T08:57:49.636249Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# on 显示指定“外键”\n",
    "print(pd.merge(df_obj1, df_obj2, on='key'))"
   ],
   "id": "73eff2e36b2b48f5",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  key  data1  data2\n",
      "0   b      5      2\n",
      "1   b      5      2\n",
      "2   a      4      9\n",
      "3   a      9      9\n",
      "4   a      7      9\n",
      "5   b      0      2\n"
     ]
    }
   ],
   "execution_count": 21
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:57:58.890978Z",
     "start_time": "2025-01-08T08:57:58.881556Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# left_on， right_on 分别指定左侧数据和右侧数据的“外键”\n",
    "# 更改列名\n",
    "df_obj1 = df_obj1.rename(columns={'key':'key1'})\n",
    "df_obj2 = df_obj2.rename(columns={'key':'key2'})\n",
    "print(pd.merge(df_obj1, df_obj2, left_on='key1', right_on='key2'))"
   ],
   "id": "23a658ebc0840a70",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  key1  data1 key2  data2\n",
      "0    b      5    b      2\n",
      "1    b      5    b      2\n",
      "2    a      4    a      9\n",
      "3    a      9    a      9\n",
      "4    a      7    a      9\n",
      "5    b      0    b      2\n"
     ]
    }
   ],
   "execution_count": 22
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:58:09.196052Z",
     "start_time": "2025-01-08T08:58:09.175572Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# “外连接”\n",
    "print(pd.merge(df_obj1, df_obj2, left_on='key1', right_on='key2', how='outer'))"
   ],
   "id": "f58b96cb17cfda81",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  key1  data1 key2  data2\n",
      "0    a    4.0    a    9.0\n",
      "1    a    9.0    a    9.0\n",
      "2    a    7.0    a    9.0\n",
      "3    b    5.0    b    2.0\n",
      "4    b    5.0    b    2.0\n",
      "5    b    0.0    b    2.0\n",
      "6    c    6.0  NaN    NaN\n",
      "7  NaN    NaN    d    3.0\n"
     ]
    }
   ],
   "execution_count": 23
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:58:23.766389Z",
     "start_time": "2025-01-08T08:58:23.757709Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 左连接\n",
    "print(pd.merge(df_obj1, df_obj2, left_on='key1', right_on='key2', how='left'))"
   ],
   "id": "6b3cd84d3d3a87f3",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  key1  data1 key2  data2\n",
      "0    b      5    b    2.0\n",
      "1    b      5    b    2.0\n",
      "2    a      4    a    9.0\n",
      "3    c      6  NaN    NaN\n",
      "4    a      9    a    9.0\n",
      "5    a      7    a    9.0\n",
      "6    b      0    b    2.0\n"
     ]
    }
   ],
   "execution_count": 24
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:58:35.193399Z",
     "start_time": "2025-01-08T08:58:35.185906Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 右连接\n",
    "print(pd.merge(df_obj1, df_obj2, left_on='key1', right_on='key2', how='right'))"
   ],
   "id": "6c8a67bfe9ee99cd",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  key1  data1 key2  data2\n",
      "0    a    4.0    a      9\n",
      "1    a    9.0    a      9\n",
      "2    a    7.0    a      9\n",
      "3    b    5.0    b      2\n",
      "4    b    5.0    b      2\n",
      "5    b    0.0    b      2\n",
      "6  NaN    NaN    d      3\n"
     ]
    }
   ],
   "execution_count": 25
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:58:44.918787Z",
     "start_time": "2025-01-08T08:58:44.906928Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 处理重复列名\n",
    "df_obj1 = pd.DataFrame({'key': ['b', 'b', 'a', 'c', 'a', 'a', 'b'],'data' : np.random.randint(0,10,7)})\n",
    "df_obj2 = pd.DataFrame({'key': ['a', 'b', 'd'],'data' : np.random.randint(0,10,3)})\n",
    "print(pd.merge(df_obj1, df_obj2, on='key', suffixes=('_left', '_right')))"
   ],
   "id": "e437eadf76c0879d",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  key  data_left  data_right\n",
      "0   b          0           0\n",
      "1   b          2           0\n",
      "2   a          8           9\n",
      "3   a          9           9\n",
      "4   a          9           9\n",
      "5   b          3           0\n"
     ]
    }
   ],
   "execution_count": 26
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:58:54.798415Z",
     "start_time": "2025-01-08T08:58:54.789616Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 按索引连接\n",
    "df_obj1 = pd.DataFrame({'key': ['b', 'b', 'a', 'c', 'a', 'a', 'b'],'data1' : np.random.randint(0,10,7)})\n",
    "df_obj2 = pd.DataFrame({'data2' : np.random.randint(0,10,3)}, index=['a', 'b', 'd'])\n",
    "print(pd.merge(df_obj1, df_obj2, left_on='key', right_index=True))"
   ],
   "id": "22920bd638b3caf1",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  key  data1  data2\n",
      "0   b      0      8\n",
      "1   b      5      8\n",
      "2   a      9      0\n",
      "4   a      5      0\n",
      "5   a      8      0\n",
      "6   b      3      8\n"
     ]
    }
   ],
   "execution_count": 27
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "3、练习重复值处理",
   "id": "b268bf8b9db02988"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:59:26.766841Z",
     "start_time": "2025-01-08T08:59:26.755140Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#duplicated() 返回布尔型 Series 表示每行是否为重复行\n",
    "df_obj = pd.DataFrame({'data1' : ['a'] * 4 + ['b'] * 4,'data2' : np.random.randint(0, 4, 8)})\n",
    "print(df_obj)\n",
    "print(df_obj.duplicated())"
   ],
   "id": "296c782c5d2ffe37",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  data1  data2\n",
      "0     a      1\n",
      "1     a      3\n",
      "2     a      3\n",
      "3     a      1\n",
      "4     b      3\n",
      "5     b      3\n",
      "6     b      0\n",
      "7     b      0\n",
      "0    False\n",
      "1    False\n",
      "2     True\n",
      "3     True\n",
      "4    False\n",
      "5     True\n",
      "6    False\n",
      "7     True\n",
      "dtype: bool\n"
     ]
    }
   ],
   "execution_count": 28
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:59:37.493346Z",
     "start_time": "2025-01-08T08:59:37.477701Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#drop_duplicates() 过滤重复行\n",
    "print(df_obj.drop_duplicates())\n",
    "print(df_obj.drop_duplicates('data2'))"
   ],
   "id": "c9bb9c1ba2ff0203",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  data1  data2\n",
      "0     a      1\n",
      "1     a      3\n",
      "4     b      3\n",
      "6     b      0\n",
      "  data1  data2\n",
      "0     a      1\n",
      "1     a      3\n",
      "6     b      0\n"
     ]
    }
   ],
   "execution_count": 29
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:59:47.716930Z",
     "start_time": "2025-01-08T08:59:47.701624Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#根据 map 传入的函数对每行或每列进行转换\n",
    "ser_obj = pd.Series(np.random.randint(0,10,10))\n",
    "print(ser_obj)\n",
    "print(ser_obj.map(lambda x : x ** 2))"
   ],
   "id": "11c50da5c6cb6fd0",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0    9\n",
      "1    3\n",
      "2    6\n",
      "3    6\n",
      "4    0\n",
      "5    8\n",
      "6    8\n",
      "7    1\n",
      "8    4\n",
      "9    5\n",
      "dtype: int32\n",
      "0    81\n",
      "1     9\n",
      "2    36\n",
      "3    36\n",
      "4     0\n",
      "5    64\n",
      "6    64\n",
      "7     1\n",
      "8    16\n",
      "9    25\n",
      "dtype: int64\n"
     ]
    }
   ],
   "execution_count": 30
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T08:59:56.087236Z",
     "start_time": "2025-01-08T08:59:56.078656Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#replace 根据值的内容进行替换\n",
    "\n",
    "# 单个值替换单个值\n",
    "print(ser_obj.replace(1, -100))\n",
    "# 多个值替换一个值\n",
    "print(ser_obj.replace([6, 8], -100))\n",
    "# 多个值替换多个值\n",
    "print(ser_obj.replace([4, 7], [-100, -200]))"
   ],
   "id": "9b5da22cba9dca2",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0      9\n",
      "1      3\n",
      "2      6\n",
      "3      6\n",
      "4      0\n",
      "5      8\n",
      "6      8\n",
      "7   -100\n",
      "8      4\n",
      "9      5\n",
      "dtype: int32\n",
      "0      9\n",
      "1      3\n",
      "2   -100\n",
      "3   -100\n",
      "4      0\n",
      "5   -100\n",
      "6   -100\n",
      "7      1\n",
      "8      4\n",
      "9      5\n",
      "dtype: int32\n",
      "0      9\n",
      "1      3\n",
      "2      6\n",
      "3      6\n",
      "4      0\n",
      "5      8\n",
      "6      8\n",
      "7      1\n",
      "8   -100\n",
      "9      5\n",
      "dtype: int32\n"
     ]
    }
   ],
   "execution_count": 31
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
